<?php include_once 'common/header.php'; ?>
<?php include_once 'common/navbar.php'; ?>
<div class="container-fluid">
    <div class="row">
        <?php include_once 'common/sidebar.php'; ?>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2">
            <?php include_once 'common/breadcrumb.php'; ?>
            <div class="main">
                <div class="row">
                    <div class="col-sm-6 col-md-6">
                        <div class="panel panel-default">
                            <div class="panel-heading"><b>Content type</b></div>
                            <div class="panel-body">
                                <?php include_once 'common/message.php'; ?>
                                <form class="form-horizontal" role="form" method="POST" id="contenttype">
                                    <div class="form-group">
                                        <label for="type" class="col-sm-2 control-label">Title</label>
                                        <div class="col-sm-10">
                                            <input value="<?php echo isset($type)?$type:"";?>" type="text" class="form-control" id="type" name="type" placeholder="Title">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-offset-2 col-sm-10">
                                            <?php if (isset($ctid)) { ?>
                                                <input type="hidden" id="ctid" name="ctid" value="<?php echo $ctid; ?>">
                                                <button type="button" onclick="javascript: addupdatecontenttype();" class="btn btn-default">Update</button>
                                            <?php } else { ?>
                                                <button type="button" onclick="javascript: addupdatecontenttype();" class="btn btn-default">Add</button>
                                            <?php } ?>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>Type</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $contentType = $this->contentmodel->getContentType();
                                for ($i = 0; $i < count($contentType); $i++) {
                                    ?>
                                    <tr>
                                        <td width="50"><?php echo ($i + 1) ?></td>
                                        <td><?php echo $contentType[$i]['type'] ?></td>
                                        <td width="150">
                                            <a href="<?php echo base_url().'admin/contenttype?ctid='.$contentType[$i]['pkid'];?>" class="btn btn-primary btn-xs">Edit</a>
                                            <a class="btn btn-danger btn-xs">Delete</a>
                                        </td>
                                    </tr>
                                <?php } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php include_once 'common/footer.php'; ?>